import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        s = s.toUpperCase();
        t = t.toUpperCase();
        HashMap<Character,Integer> hash = new HashMap<>();
        for (int i = 0; i < t.length(); i++) {
            char ch = t.charAt(i);
            if (hash.get(ch) == null) {
                hash.put(ch,1);
            } else {
                int val = hash.get(ch);
                hash.put(ch,val+1);
            }
        }
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (hash.get(ch) == null) {
                System.out.print(ch);
                hash.put(ch,1);
            }
        }
    }
}